import json
import os
import string
from enum import Enum

from base.util.common_util import get_project_root

config_path = f'{get_project_root()}config.yaml'
out_folder = f"{get_project_root()}out{os.sep}"
sessionKeyname = ['id', 'segmentCnt', 'tcpflags.rst', 'tcpflags.ack', 'tcpflags.syn', 'tcpflags.urg', 'tcpflags.psh',
                  'tcpflags.syn-ack', 'tcpflags.fin', 'source.ip', 'destination.ip', 'source.port', 'source.packets',
                  'source.bytes', 'destination.port', 'destination.bytes', 'destination.packets', 'initRTT',
                  'firstPacket', 'lastPacket', 'ipProtocol', 'protocolCnt', 'protocol', 'server.bytes', 'totDataBytes',
                  'network.packets', 'network.bytes', 'length', 'client.bytes', 'http.uri',
                  'http.response-content-type', 'http.bodyMagicCnt', 'http.statuscodeCnt', 'http.clientVersionCnt',
                  'http.response-content-typeCnt', 'http.xffIpCnt', 'http.requestHeaderCnt', 'http.serverVersion',
                  'http.responseHeaderCnt', 'http.xffIp', 'http.clientVersion', 'http.uriTokens',
                  'http.request-refererCnt', 'http.useragentCnt', 'http.statuscode', 'http.bodyMagic', 'http.methodCnt',
                  'http.request-content-type', 'http.uriCnt', 'http.serverVersionCnt', 'http.useragent', 'http.keyCnt',
                  'http.request-referer', 'http.path', 'http.hostCnt', 'http.response-server', 'http.pathCnt',
                  'http.useragentTokens', 'http.method-GET', 'http.method', 'http.key', 'http.hostTokens',
                  'http.requestHeader', 'http.responseHeader', 'http.method-POST', 'dns.ASN', 'dns.RIR', 'dns.GEO',
                  'dns.alpn', 'dns.alpnCnt', 'dns.ip', 'dns.host', 'dns.ipCnt', 'dns.OpCode', 'dns.OpCodeCnt',
                  'dns.Puny',
                  'dns.PunyCnt', 'dns.QueryClass', 'dns.QueryClassCnt', 'dns.QueryType', 'dns.QueryTypeCnt',
                  'dns.status', 'dns.statusCnt', 'tls.cipher', 'tls.cipherCnt', 'tls.dstSessionId', 'tls.ja3',
                  'tls.ja3Cnt', 'tls.ja3s', 'tls.ja3sCnt', 'tls.ja4', 'tls.ja4Cnt', 'tls.srcSessionId', 'tls.version',
                  'tls.versionCnt', 'tls.ja4_r', 'tls.ja4_rCnt', 'packetPos', 'source.ip_Country_IsoCode',
                  'source.ip_Country_Name', 'source.ip_Country_SpecificName',
                  'source.ip_Country_SpecificIsoCode', 'source.ip_City_Name', 'source.ip_City_PostalCode',
                  'source.ip_Location_Latitude', 'source.ip_Location_Longitude', 'destination.ip_Country_IsoCode',
                  'destination.ip_Country_Name', 'destination.ip_Country_SpecificName',
                  'destination.ip_Country_SpecificIsoCode', 'destination.ip_City_Name',
                  'destination.ip_City_PostalCode', 'destination.ip_Location_Latitude',
                  'destination.ip_Location_Longitude', 'http.uri_length_mean', 'http.uri_length_var',
                  "http.uri_param_count_mean", "http.uri_param_count_var", "http.uri_depth_mean", "http.uri_depth_var",
                  "http.uri_filename_length_mean", "http.uri_filename_length_var", "dns_domain_length_mean",
                  "dns_domain_length_var"]
otherHeader = ["src_host", "src_user_agent", "src_content_length", "src_connection", "src_content_type",
               "src_x_forwarded_for", "src_accept", "src_accept_encoding", "src_accept_language", "src_referer",
               "src_cookie", "src_origin", "src_x_requested_with", "src_sec_fetch_mode", "src_sec_fetch_site",
               "src_sec_fetch_dest", "src_content_encoding", "src_sec_ch_ua", "src_sec_ch_ua_mobile",
               "src_sec_ch_ua_platform", "src_cache_control", "src_upgrade_insecure_requests", "src_pragma",
               "src_x_real_ip", "src_soapaction", "src_x_forwarded_proto", "src_x_forwarded_host", "src_x_request_id",
               "src_x_forwarded_port", "src_x_forwarded_scheme", "src_x_original_forwarded_for", "src_x_scheme",
               "src_x_forwarded_scheme_diy", "src_authorization", "src_trace_id", "src_distinct_id", "src_url_path",
               "src_if_modified_since", "src_ecid_context", "src_token", "src_access_control_request_method",
               "src_access_token", "src_expect", "src_access_control_request_headers", "src_sec_fetch_user",
               "src_snk_location", "src_accept_charset", "src_date", "src_usercode", "src_logincode", "src_range",
               "src_checktime", "src_client_lang", "src_requestsource", "src_if_range", "src_if_none_match", "src_sw8",
               "src_sw8_correlation", "src_sw8_x", "src_x_sign", "src_x_timestamp", "src_charset",
               "src_x_custom_header", "src_sec_websocket_key", "src_sec_websocket_version", "src_upgrade",
               "src_sec_websocket_extensions", "src_xms_auth_token", "src_xms_cluster_id", "src_purpose",
               "src_x_ti_app_id", "src_x_ti_secret_code", "src_x_prototype_version", "src_systemcode",
               "src_access_control_request_private_network", "src_wxr", "src_client_version", "src_requestid",
               "src_request_module", "src_x_mule_encoding", "src_x_mule_session", "src_elite_tag", "src_dnt",
               "src_x_mule_endpoint", "src_x_mule_root_message_id", "src_x_mass_tappid", "src_x_elastic_product_origin",
               "src_priority", "src_server", "src_transfer_encoding", "src_xxl_job_access_token", "src_te",
               "src_access_control_allow_origin", "src_eset_spread_control", "src_x_splunk_digest",
               "src_x_splunk_lm_nonce", "src_x_splunk_lm_signature", "src_x_splunk_lm_timestamp", "src_avb_version",
               "src_set_cookie", "src_x_oracle_dms_ecid", "src_x_oracle_dms_rid",
               "src_x_prometheus_scrape_timeout_seconds", "src_client", "src_post", "src_ucosessionid", "src_user",
               "src_winuser", "src_showloading", "src_digest", "src_ocrimageflag", "src_x_content_type_options",
               "src_access_control_allow_methods", "src_access_control_allow_credentials", "src_expires",
               "src_keep_alive", "src_url_token", "src_postman_token", "src_x_xss_protection", "src_vary",
               "src_access_control_allow_headers", "src_signdata", "src_ua_cpu", "src_authorg", "src_yssip",
               "src_yssmac", "src_location", "src_content_language", "src_git_protocol", "src_x_forwarded_prefix",
               "src_invoke_type", "src_x_ua_compatible", "src_x_bd_traceid", "src_x_from_h3_trnet", "src_n",
               "src_nx_anti_csrf_token", "src_proxy_connection", "src_via", "src_x_nexus_ui", "src_pragma_type",
               "src_appkey", "src_area", "src_check", "src_clientname", "src_lang", "src_networktype", "src_nonce",
               "src_osversion", "src_screen", "src_st", "src_timestamp", "src_userid", "src_x_frame_options",
               "src_x_b3_parentspanid", "src_x_b3_sampled", "src_x_b3_spanid", "src_x_b3_traceid", "src_sec_purpose",
               "src_kbn_version", "src_access_control_expose_headers", "src_iszip", "src_from", "src_state",
               "src_access_control_max_age", "src_allow", "src_kbn_system_request", "src_tracelogcontext", "src_etag",
               "src_ms_cv", "src_x_application_context", "src_x_csrftoken", "src_tlogtraceid", "src_link_pwd_token",
               "src_preip", "src_preivkapp", "src_preivkhost", "src_tlogspanid", "src_accesstoken", "src_icy_metadata",
               "src_vivo_browser_text_zoom", "src_contents_client_adapter_id", "src_last_modified",
               "src_need_select_sub_url", "src_x_bd_quic", "src_x_bdboxapp_netengine", "src_x_playback_session_id",
               "src_x_turbonet_info", "src_cas_tgc", "src_imgids", "src_jsessionid", "src_accept_ranges",
               "src_am_traceid", "src_xms_backend_server", "src_ss_language", "src_sssessionid", "src_username",
               "src_content_md5", "src_x_acs_security_token", "src_x_log_apiversion", "src_x_log_bodyrawsize",
               "src_x_log_compresstype", "src_x_log_signaturemethod", "src_x_nod32_mode", "src_client_appname",
               "src_client_requesttoken", "src_client_requestts", "src_exconfiginfo", "src_long_pulling_timeout",
               "src_dispatch_header", "src_sign", "src_strict_transport_security", "src_ts", "src_bdpparallelload",
               "src_referrer_policy", "src_x_amz_request_id", "src_x_cm_service", "src_x_miorigin",
               "src_x_seafile_client_version", "src_amz_sdk_invocation_id", "src_amz_sdk_request", "src_amz_sdk_retry",
               "src_bussno", "src_busstype", "src_classcode", "src_comcode", "src_createtime", "src_createuser",
               "src_imgfilepath", "src_imgid", "src_imgtype", "src_s_cnection", "src_storagecondition",
               "src_x_eset_updateid", "src_x_powered_by", "src_allow_cross_domain_redirect", "src_amp_cache_transform",
               "src_x_csrf_token", "src_x_check_exist", "src_sec_gpc", "src_sf_ajax", "src_request_type",
               "src_x_envoy_decorator_operation", "src_x_envoy_upstream_service_time", "src_x_from_cdn",
               "src_x_download_options", "src_x_permitted_cross_domain_policies", "src_busscode", "src_companyno",
               "src_fcpos", "src_forwarded", "src_prod_sw8", "src_prod_sw8_correlation", "src_prod_sw8_x",
               "src_rewritepath", "src_x_elastic_product", "src_x_forwarded_server", "src_in_form_img", "src_x_pjax",
               "src_age", "src_channel", "src_client_ip", "src_content_transfer_encoding", "src_guid", "src_oldchannel",
               "src_product", "src_remote_addr", "src_seafile_repo_token", "src_starttag", "src_starttype",
               "src_traceid", "src_warded_for", "src_x_aspnet_version", "src_zcid", "src_agent_version", "src_alt_svc",
               "src_cf_ray", "src_chrome_proxy", "src_content_disposition", "src_content_range",
               "src_content_security_policy", "src_d_for", "src_grpc_accept_encoding", "src_grpc_timeout",
               "src_gslb_okhttp", "src_jenkins_crumb", "src_nel", "src_orderid", "src_p3p", "src_report_to",
               "src_route_data", "src_service_worker", "src_tap_app_conf_ver", "src_tap_gslb", "src_tc_anp",
               "src_tc_entsig", "src_tc_spanid", "src_tc_traceid", "src_www_authenticate", "src_x_aggregate_auth",
               "src_x_amz_storage_class", "src_x_cache_status", "src_x_ccc", "src_x_cdn_request_id", "src_x_cid",
               "src_x_clickhouse_format", "src_x_clickhouse_query_id", "src_x_clickhouse_server_display_name",
               "src_x_clickhouse_summary", "src_x_clickhouse_timezone", "src_x_gitlab_feature_category",
               "src_x_link_via", "src_x_ucbrowser_ua", "dst_date", "dst_content_type", "dst_content_length",
               "dst_transfer_encoding", "dst_connection", "dst_set_cookie", "dst_x_oracle_dms_ecid",
               "dst_x_oracle_dms_rid", "dst_content_language", "dst_cache_control", "dst_server", "dst_expires",
               "dst_pragma", "dst_access_control_allow_origin", "dst_keep_alive", "dst_vary", "dst_last_modified",
               "dst_access_control_allow_credentials", "dst_access_control_allow_methods", "dst_accept_ranges",
               "dst_access_control_allow_headers", "dst_x_content_type_options", "dst_etag",
               "dst_access_control_max_age", "dst_content_encoding", "dst_access_control_expose_headers",
               "dst_x_xss_protection", "dst_access_control_request_headers", "dst_x_frame_options", "dst_location",
               "dst_x_powered_by", "dst_x_application_context", "dst_p3p", "dst_x_ua_compatible", "dst_x_mule_encoding",
               "dst_x_mule_session", "dst_s_cnection", "dst_x_amz_request_id", "dst_content_disposition",
               "dst_x_amz_storage_class", "dst_content_range", "dst_pragma_type", "dst_allow", "dst_xms_backend_server",
               "dst_x_clickhouse_server_display_name", "dst_x_clickhouse_summary", "dst_x_clickhouse_format",
               "dst_x_clickhouse_query_id", "dst_x_clickhouse_timezone", "dst_referrer_policy",
               "dst_content_security_policy", "dst_content_id", "dst_sec_websocket_accept", "dst_upgrade",
               "dst_tlogtraceid", "dst_sec_websocket_extensions", "dst_x_elastic_product", "dst_via", "dst_x_cache",
               "dst_x_amz_cf_id", "dst_x_amz_cf_pop", "dst_rgwx_embedded_metadata_len", "dst_rgwx_mtime",
               "dst_rgwx_obj_pg_ver", "dst_rgwx_object_size", "dst_rgwx_source_zone_short_id", "dst_x_amz_version_id",
               "dst_x_request_id", "dst_x_envoy_decorator_operation", "dst_x_envoy_upstream_service_time", "dst_age",
               "dst_www_authenticate", "dst_strict_transport_security", "dst_terminationurl", "dst_x_splunk_digest",
               "dst_x_splunk_lm_nonce", "dst_x_splunk_lm_timestamp", "dst_x_download_options",
               "dst_x_permitted_cross_domain_policies", "dst_pragrma", "dst_content_transfer_encoding", "dst_x_runtime",
               "dst_x_arequestid", "dst_x_ausername", "dst_x_asessionid", "dst_x_aspnet_version",
               "dst_x_seraph_loginreason", "dst_accept_charset", "dst_n", "dst_error_code", "dst_error_msg",
               "dst_x_w_no", "dst_kbn_license_sig", "dst_kbn_name", "dst_cross_origin_opener_policy",
               "dst_xdomainrequestallowed", "dst_x_ratelimit_limit_vass_zuul_api_user_24",
               "dst_x_ratelimit_remaining_vass_zuul_api_use", "dst_x_ratelimit_remaining_vass_zuul_wx_port",
               "dst_x_ratelimit_reset_vass_zuul_api_user_24", "dst_audit_id", "dst_x_kubernetes_pf_flowschema_uid",
               "dst_x_kubernetes_pf_prioritylevel_uid", "dst_alt_svc", "dst_cf_ray", "dst_nel", "dst_report_to",
               "dst_x_ratelimit_remaining_vass_zuul_api_ord", "dst_x_protected_by", "dst_traceresponse",
               "dst_x_br_response", "dst_x_cache_status", "dst_x_ratelimit_limit_vass_zuul_api_order_1",
               "dst_x_ratelimit_reset_vass_zuul_api_order_1", "dst_grpc_metadata_accept_encoding",
               "dst_grpc_metadata_content_type", "dst_grpc_metadata_grpc_accept_encoding",
               "dst_x_ratelimit_limit_vass_zuul_wx_port_240", "dst_x_ratelimit_reset_vass_zuul_wx_port_240",
               "dst_permissions_policy", "dst_ctl_cache_status", "dst_progma", "dst_request_id", "dst_x_csrf_token",
               "dst_x_log_append_meta", "dst_x_log_requestid", "dst_x_log_time", "dst_hostname",
               "dst_x_networkmanager_status", "dst_browseruid", "dst_k_cache_status", "dst_kcs_via", "dst_x_ccc",
               "dst_x_cid", "dst_page_title", "dst_x_via", "dst_x_ws_request_id", "dst_enable_encrypted_library",
               "dst_expire", "dst_x_ratelimit_limit_vass_zuul_wx_port_39.",
               "dst_x_ratelimit_reset_vass_zuul_wx_port_39.", "dst_content_location", "dst_gsid", "dst_sc",
               "dst_x_response_timestrap", "dst_link", "dst_x_ratelimit_limit_vass_zuul_api_order_2",
               "dst_x_ratelimit_limit_vass_zuul_wx_port_10.", "dst_x_ratelimit_reset_vass_zuul_api_order_2",
               "dst_x_ratelimit_reset_vass_zuul_wx_port_10.", "dst_x_reqid", "dst_login", "dst_x_cache_lookup",
               "dst_x_cdn_request_id", "dst_x_link_via", "dst_x_nws_log_uuid",
               "dst_x_ratelimit_limit_vass_zuul_wx_port_111", "dst_x_ratelimit_reset_vass_zuul_wx_port_111",
               "dst_cache_contror", "dst_cdn_cache", "dst_cdn_cachedat", "dst_cdn_edgestorageid", "dst_cdn_proxyver",
               "dst_cdn_pullzone", "dst_cdn_requestcountrycode", "dst_cdn_requestid", "dst_cdn_requestpullcode",
               "dst_cdn_requestpullsuccess", "dst_cdn_status", "dst_cdn_uid", "dst_gitlab_ci_builds_polling",
               "dst_new_jwt", "dst_ohc_cache_hit", "dst_ohc_file_size", "dst_ohc_global_saved_time", "dst_x_hudson",
               "dst_x_instance_identity", "dst_x_jenkins", "dst_x_jenkins_session", "dst_dir_perm", "dst_fndfs_error",
               "dst_oid", "dst_x_errno", "dst_x_hudson_theme", "dst_x_oss_hash_crc64ecma", "dst_x_ser",
               "dst_content_md5", "dst_exception", "dst_exceptiontype", "dst_praga", "dst_x_oss_object_type",
               "dst_x_oss_request_id", "dst_x_oss_server_time", "dst_x_oss_storage_class",
               "dst_x_ratelimit_limit_vass_zuul_api_order_3", "dst_x_ratelimit_reset_vass_zuul_api_order_3"]
statisticHeader = ['packet_size_mean', 'packet_size_variance', 'packet_len_total_count', 'packet_len_total_average',
                   'packet_len_total_min', 'packet_len_total_max', 'packet_len_total_rate', 'packet_len_total_percent',
                   'packet_len_0_19_count', 'packet_len_0_19_average', 'packet_len_0_19_min', 'packet_len_0_19_max',
                   'packet_len_0_19_rate', 'packet_len_0_19_percent', 'packet_len_20_39_count',
                   'packet_len_20_39_average', 'packet_len_20_39_min', 'packet_len_20_39_max', 'packet_len_20_39_rate',
                   'packet_len_20_39_percent', 'packet_len_40_79_count', 'packet_len_40_79_average',
                   'packet_len_40_79_min', 'packet_len_40_79_max', 'packet_len_40_79_rate', 'packet_len_40_79_percent',
                   'packet_len_80_159_count', 'packet_len_80_159_average', 'packet_len_80_159_min',
                   'packet_len_80_159_max', 'packet_len_80_159_rate', 'packet_len_80_159_percent',
                   'packet_len_160_319_count', 'packet_len_160_319_average', 'packet_len_160_319_min',
                   'packet_len_160_319_max', 'packet_len_160_319_rate', 'packet_len_160_319_percent',
                   'packet_len_320_639_count', 'packet_len_320_639_average', 'packet_len_320_639_min',
                   'packet_len_320_639_max', 'packet_len_320_639_rate', 'packet_len_320_639_percent',
                   'packet_len_640_1279_count', 'packet_len_640_1279_average', 'packet_len_640_1279_min',
                   'packet_len_640_1279_max', 'packet_len_640_1279_rate', 'packet_len_640_1279_percent',
                   'packet_len_1280_2559_count', 'packet_len_1280_2559_average', 'packet_len_1280_2559_min',
                   'packet_len_1280_2559_max', 'packet_len_1280_2559_rate', 'packet_len_1280_2559_percent',
                   'packet_len_2560_5119_count', 'packet_len_2560_5119_average', 'packet_len_2560_5119_min',
                   'packet_len_2560_5119_max', 'packet_len_2560_5119_rate', 'packet_len_2560_5119_percent',
                   'packet_len_more_than_5120_count', 'packet_len_more_than_5120_average',
                   'packet_len_more_than_5120_min', 'packet_len_more_than_5120_max', 'packet_len_more_than_5120_rate',
                   'packet_len_more_than_5120_percent', 'all_req_packet_size_mean', 'all_req_packet_size_var',
                   'all_res_packet_size_mean', 'all_res_packet_size_var', 'all_req_packet_time_period_mean',
                   'all_res_packet_time_period_mean', 'all_req_packet_time_period_var',
                   'all_res_packet_time_period_var', 'req_header_count_mean', 'req_header_count_var']
labelHeader = ['same_src_dst_size_mean', 'same_src_dst_size_var', 'packet_size_mean', 'same_src_dst_size_mean',
               'isDangerous', 'DENY_METHOD', 'PROTOCOL', 'SEVERITY', 'THREAT_SUMMARY']
mapping_values = {"id": "A", "segmentCnt": "B", "tcpflags.rst": "C", "tcpflags.ack": "D", "tcpflags.syn": "E",
                  "tcpflags.urg": "F", "tcpflags.psh": "G", "tcpflags.syn-ack": "H", "tcpflags.fin": "I",
                  "source.ip": "J", "destination.ip": "K", "source.port": "L", "source.packets": "M",
                  "source.bytes": "N", "destination.port": "O", "destination.bytes": "P", "destination.packets": "Q",
                  "initRTT": "R", "firstPacket": "S", "lastPacket": "T", "ipProtocol": "U", "protocolCnt": "V",
                  "protocol": "W", "server.bytes": "X", "totDataBytes": "Y", "network.packets": "Z",
                  "network.bytes": "AA", "length": "AB", "client.bytes": "AC", "http.uri": "AD",
                  "http.response-content-type": "AE", "http.bodyMagicCnt": "AF", "http.statuscodeCnt": "AG",
                  "http.clientVersionCnt": "AH", "http.response-content-typeCnt": "AI", "http.xffIpCnt": "AJ",
                  "http.requestHeaderCnt": "AK", "http.serverVersion": "AL", "http.responseHeaderCnt": "AM",
                  "http.xffIp": "AN", "http.clientVersion": "AO", "http.uriTokens": "AP",
                  "http.request-refererCnt": "AQ", "http.useragentCnt": "AR", "http.statuscode": "AS",
                  "http.bodyMagic": "AT", "http.methodCnt": "AU", "http.request-content-type": "AV",
                  "http.uriCnt": "AW", "http.serverVersionCnt": "AX", "http.useragent": "AY", "http.keyCnt": "AZ",
                  "http.request-referer": "BA", "http.path": "BB", "http.hostCnt": "BC", "http.response-server": "BD",
                  "http.pathCnt": "BE", "http.useragentTokens": "BF", "http.method-GET": "BG", "http.method": "BH",
                  "http.key": "BI", "http.hostTokens": "BJ", "http.requestHeader": "BK", "http.responseHeader": "BL",
                  "http.method-POST": "BM", "dns.ASN": "BN", "dns.RIR": "BO", "dns.GEO": "BP", "dns.alpn": "BQ",
                  "dns.alpnCnt": "BR", "dns.ip": "BS", "dns.host": "BT", "dns.ipCnt": "BU", "dns.OpCode": "BV",
                  "dns.OpCodeCnt": "BW", "dns.Puny": "BX", "dns.PunyCnt": "BY", "dns.QueryClass": "BZ",
                  "dns.QueryClassCnt": "CA", "dns.QueryType": "CB", "dns.QueryTypeCnt": "CC", "dns.status": "CD",
                  "dns.statusCnt": "CE", "tls.cipher": "CF", "tls.cipherCnt": "CG", "tls.dstSessionId": "CH",
                  "tls.ja3": "CI", "tls.ja3Cnt": "CJ", "tls.ja3s": "CK", "tls.ja3sCnt": "CL", "tls.ja4": "CM",
                  "tls.ja4Cnt": "CN", "tls.srcSessionId": "CO", "tls.version": "CP", "tls.versionCnt": "CQ",
                  "tls.ja4_r": "CR", "tls.ja4_rCnt": "CS", "packetPos": "CT", "source.ip_Country_IsoCode": "CU",
                  "source.ip_Country_Name": "CV", "source.ip_Country_SpecificName": "CW",
                  "source.ip_Country_SpecificIsoCode": "CX", "source.ip_City_Name": "CY",
                  "source.ip_City_PostalCode": "CZ", "source.ip_Location_Latitude": "DA",
                  "source.ip_Location_Longitude": "DB", "destination.ip_Country_IsoCode": "DC",
                  "destination.ip_Country_Name": "DD", "destination.ip_Country_SpecificName": "DE",
                  "destination.ip_Country_SpecificIsoCode": "DF", "destination.ip_City_Name": "DG",
                  "destination.ip_City_PostalCode": "DH", "destination.ip_Location_Latitude": "DI",
                  "destination.ip_Location_Longitude": "DJ", "http.uri_length_mean": "DK", "http.uri_length_var": "DL",
                  "http.uri_param_count_mean": "DM", "http.uri_param_count_var": "DN", "http.uri_depth_mean": "DO",
                  "http.uri_depth_var": "DP", "http.uri_filename_length_mean": "DQ",
                  "http.uri_filename_length_var": "DR", "dns_domain_length_mean": "DS", "dns_domain_length_var": "DT",
                  "src_host": "DU", "src_user_agent": "DV", "src_content_length": "DW", "src_connection": "DX",
                  "src_content_type": "DY", "src_x_forwarded_for": "DZ", "src_accept": "EA",
                  "src_accept_encoding": "EB", "src_accept_language": "EC", "src_referer": "ED", "src_cookie": "EE",
                  "src_origin": "EF", "src_x_requested_with": "EG", "src_sec_fetch_mode": "EH",
                  "src_sec_fetch_site": "EI", "src_sec_fetch_dest": "EJ", "src_content_encoding": "EK",
                  "src_sec_ch_ua": "EL", "src_sec_ch_ua_mobile": "EM", "src_sec_ch_ua_platform": "EN",
                  "src_cache_control": "EO", "src_upgrade_insecure_requests": "EP", "src_pragma": "EQ",
                  "src_x_real_ip": "ER", "src_soapaction": "ES", "src_x_forwarded_proto": "ET",
                  "src_x_forwarded_host": "EU", "src_x_request_id": "EV", "src_x_forwarded_port": "EW",
                  "src_x_forwarded_scheme": "EX", "src_x_original_forwarded_for": "EY", "src_x_scheme": "EZ",
                  "src_x_forwarded_scheme_diy": "FA", "src_authorization": "FB", "src_trace_id": "FC",
                  "src_distinct_id": "FD", "src_url_path": "FE", "src_if_modified_since": "FF",
                  "src_ecid_context": "FG", "src_token": "FH", "src_access_control_request_method": "FI",
                  "src_access_token": "FJ", "src_expect": "FK", "src_access_control_request_headers": "FL",
                  "src_sec_fetch_user": "FM", "src_snk_location": "FN", "src_accept_charset": "FO", "src_date": "FP",
                  "src_usercode": "FQ", "src_logincode": "FR", "src_range": "FS", "src_checktime": "FT",
                  "src_client_lang": "FU", "src_requestsource": "FV", "src_if_range": "FW", "src_if_none_match": "FX",
                  "src_sw8": "FY", "src_sw8_correlation": "FZ", "src_sw8_x": "GA", "src_x_sign": "GB",
                  "src_x_timestamp": "GC", "src_charset": "GD", "src_x_custom_header": "GE",
                  "src_sec_websocket_key": "GF", "src_sec_websocket_version": "GG", "src_upgrade": "GH",
                  "src_sec_websocket_extensions": "GI", "src_xms_auth_token": "GJ", "src_xms_cluster_id": "GK",
                  "src_purpose": "GL", "src_x_ti_app_id": "GM", "src_x_ti_secret_code": "GN",
                  "src_x_prototype_version": "GO", "src_systemcode": "GP",
                  "src_access_control_request_private_network": "GQ", "src_wxr": "GR", "src_client_version": "GS",
                  "src_requestid": "GT", "src_request_module": "GU", "src_x_mule_encoding": "GV",
                  "src_x_mule_session": "GW", "src_elite_tag": "GX", "src_dnt": "GY", "src_x_mule_endpoint": "GZ",
                  "src_x_mule_root_message_id": "HA", "src_x_mass_tappid": "HB", "src_x_elastic_product_origin": "HC",
                  "src_priority": "HD", "src_server": "HE", "src_transfer_encoding": "HF",
                  "src_xxl_job_access_token": "HG", "src_te": "HH", "src_access_control_allow_origin": "HI",
                  "src_eset_spread_control": "HJ", "src_x_splunk_digest": "HK", "src_x_splunk_lm_nonce": "HL",
                  "src_x_splunk_lm_signature": "HM", "src_x_splunk_lm_timestamp": "HN", "src_avb_version": "HO",
                  "src_set_cookie": "HP", "src_x_oracle_dms_ecid": "HQ", "src_x_oracle_dms_rid": "HR",
                  "src_x_prometheus_scrape_timeout_seconds": "HS", "src_client": "HT", "src_post": "HU",
                  "src_ucosessionid": "HV", "src_user": "HW", "src_winuser": "HX", "src_showloading": "HY",
                  "src_digest": "HZ", "src_ocrimageflag": "IA", "src_x_content_type_options": "IB",
                  "src_access_control_allow_methods": "IC", "src_access_control_allow_credentials": "ID",
                  "src_expires": "IE", "src_keep_alive": "IF", "src_url_token": "IG", "src_postman_token": "IH",
                  "src_x_xss_protection": "II", "src_vary": "IJ", "src_access_control_allow_headers": "IK",
                  "src_signdata": "IL", "src_ua_cpu": "IM", "src_authorg": "IN", "src_yssip": "IO", "src_yssmac": "IP",
                  "src_location": "IQ", "src_content_language": "IR", "src_git_protocol": "IS",
                  "src_x_forwarded_prefix": "IT", "src_invoke_type": "IU", "src_x_ua_compatible": "IV",
                  "src_x_bd_traceid": "IW", "src_x_from_h3_trnet": "IX", "src_n": "IY", "src_nx_anti_csrf_token": "IZ",
                  "src_proxy_connection": "JA", "src_via": "JB", "src_x_nexus_ui": "JC", "src_pragma_type": "JD",
                  "src_appkey": "JE", "src_area": "JF", "src_check": "JG", "src_clientname": "JH", "src_lang": "JI",
                  "src_networktype": "JJ", "src_nonce": "JK", "src_osversion": "JL", "src_screen": "JM", "src_st": "JN",
                  "src_timestamp": "JO", "src_userid": "JP", "src_x_frame_options": "JQ", "src_x_b3_parentspanid": "JR",
                  "src_x_b3_sampled": "JS", "src_x_b3_spanid": "JT", "src_x_b3_traceid": "JU", "src_sec_purpose": "JV",
                  "src_kbn_version": "JW", "src_access_control_expose_headers": "JX", "src_iszip": "JY",
                  "src_from": "JZ", "src_state": "KA", "src_access_control_max_age": "KB", "src_allow": "KC",
                  "src_kbn_system_request": "KD", "src_tracelogcontext": "KE", "src_etag": "KF", "src_ms_cv": "KG",
                  "src_x_application_context": "KH", "src_x_csrftoken": "KI", "src_tlogtraceid": "KJ",
                  "src_link_pwd_token": "KK", "src_preip": "KL", "src_preivkapp": "KM", "src_preivkhost": "KN",
                  "src_tlogspanid": "KO", "src_accesstoken": "KP", "src_icy_metadata": "KQ",
                  "src_vivo_browser_text_zoom": "KR", "src_contents_client_adapter_id": "KS", "src_last_modified": "KT",
                  "src_need_select_sub_url": "KU", "src_x_bd_quic": "KV", "src_x_bdboxapp_netengine": "KW",
                  "src_x_playback_session_id": "KX", "src_x_turbonet_info": "KY", "src_cas_tgc": "KZ",
                  "src_imgids": "LA", "src_jsessionid": "LB", "src_accept_ranges": "LC", "src_am_traceid": "LD",
                  "src_xms_backend_server": "LE", "src_ss_language": "LF", "src_sssessionid": "LG",
                  "src_username": "LH", "src_content_md5": "LI", "src_x_acs_security_token": "LJ",
                  "src_x_log_apiversion": "LK", "src_x_log_bodyrawsize": "LL", "src_x_log_compresstype": "LM",
                  "src_x_log_signaturemethod": "LN", "src_x_nod32_mode": "LO", "src_client_appname": "LP",
                  "src_client_requesttoken": "LQ", "src_client_requestts": "LR", "src_exconfiginfo": "LS",
                  "src_long_pulling_timeout": "LT", "src_dispatch_header": "LU", "src_sign": "LV",
                  "src_strict_transport_security": "LW", "src_ts": "LX", "src_bdpparallelload": "LY",
                  "src_referrer_policy": "LZ", "src_x_amz_request_id": "MA", "src_x_cm_service": "MB",
                  "src_x_miorigin": "MC", "src_x_seafile_client_version": "MD", "src_amz_sdk_invocation_id": "ME",
                  "src_amz_sdk_request": "MF", "src_amz_sdk_retry": "MG", "src_bussno": "MH", "src_busstype": "MI",
                  "src_classcode": "MJ", "src_comcode": "MK", "src_createtime": "ML", "src_createuser": "MM",
                  "src_imgfilepath": "MN", "src_imgid": "MO", "src_imgtype": "MP", "src_s_cnection": "MQ",
                  "src_storagecondition": "MR", "src_x_eset_updateid": "MS", "src_x_powered_by": "MT",
                  "src_allow_cross_domain_redirect": "MU", "src_amp_cache_transform": "MV", "src_x_csrf_token": "MW",
                  "src_x_check_exist": "MX", "src_sec_gpc": "MY", "src_sf_ajax": "MZ", "src_request_type": "NA",
                  "src_x_envoy_decorator_operation": "NB", "src_x_envoy_upstream_service_time": "NC",
                  "src_x_from_cdn": "ND", "src_x_download_options": "NE", "src_x_permitted_cross_domain_policies": "NF",
                  "src_busscode": "NG", "src_companyno": "NH", "src_fcpos": "NI", "src_forwarded": "NJ",
                  "src_prod_sw8": "NK", "src_prod_sw8_correlation": "NL", "src_prod_sw8_x": "NM",
                  "src_rewritepath": "NN", "src_x_elastic_product": "NO", "src_x_forwarded_server": "NP",
                  "src_in_form_img": "NQ", "src_x_pjax": "NR", "src_age": "NS", "src_channel": "NT",
                  "src_client_ip": "NU", "src_content_transfer_encoding": "NV", "src_guid": "NW",
                  "src_oldchannel": "NX", "src_product": "NY", "src_remote_addr": "NZ", "src_seafile_repo_token": "OA",
                  "src_starttag": "OB", "src_starttype": "OC", "src_traceid": "OD", "src_warded_for": "OE",
                  "src_x_aspnet_version": "OF", "src_zcid": "OG", "src_agent_version": "OH", "src_alt_svc": "OI",
                  "src_cf_ray": "OJ", "src_chrome_proxy": "OK", "src_content_disposition": "OL",
                  "src_content_range": "OM", "src_content_security_policy": "ON", "src_d_for": "OO",
                  "src_grpc_accept_encoding": "OP", "src_grpc_timeout": "OQ", "src_gslb_okhttp": "OR",
                  "src_jenkins_crumb": "OS", "src_nel": "OT", "src_orderid": "OU", "src_p3p": "OV",
                  "src_report_to": "OW", "src_route_data": "OX", "src_service_worker": "OY",
                  "src_tap_app_conf_ver": "OZ", "src_tap_gslb": "PA", "src_tc_anp": "PB", "src_tc_entsig": "PC",
                  "src_tc_spanid": "PD", "src_tc_traceid": "PE", "src_www_authenticate": "PF",
                  "src_x_aggregate_auth": "PG", "src_x_amz_storage_class": "PH", "src_x_cache_status": "PI",
                  "src_x_ccc": "PJ", "src_x_cdn_request_id": "PK", "src_x_cid": "PL", "src_x_clickhouse_format": "PM",
                  "src_x_clickhouse_query_id": "PN", "src_x_clickhouse_server_display_name": "PO",
                  "src_x_clickhouse_summary": "PP", "src_x_clickhouse_timezone": "PQ",
                  "src_x_gitlab_feature_category": "PR", "src_x_link_via": "PS", "src_x_ucbrowser_ua": "PT",
                  "dst_date": "PU", "dst_content_type": "PV", "dst_content_length": "PW", "dst_transfer_encoding": "PX",
                  "dst_connection": "PY", "dst_set_cookie": "PZ", "dst_x_oracle_dms_ecid": "QA",
                  "dst_x_oracle_dms_rid": "QB", "dst_content_language": "QC", "dst_cache_control": "QD",
                  "dst_server": "QE", "dst_expires": "QF", "dst_pragma": "QG", "dst_access_control_allow_origin": "QH",
                  "dst_keep_alive": "QI", "dst_vary": "QJ", "dst_last_modified": "QK",
                  "dst_access_control_allow_credentials": "QL", "dst_access_control_allow_methods": "QM",
                  "dst_accept_ranges": "QN", "dst_access_control_allow_headers": "QO",
                  "dst_x_content_type_options": "QP", "dst_etag": "QQ", "dst_access_control_max_age": "QR",
                  "dst_content_encoding": "QS", "dst_access_control_expose_headers": "QT", "dst_x_xss_protection": "QU",
                  "dst_access_control_request_headers": "QV", "dst_x_frame_options": "QW", "dst_location": "QX",
                  "dst_x_powered_by": "QY", "dst_x_application_context": "QZ", "dst_p3p": "RA",
                  "dst_x_ua_compatible": "RB", "dst_x_mule_encoding": "RC", "dst_x_mule_session": "RD",
                  "dst_s_cnection": "RE", "dst_x_amz_request_id": "RF", "dst_content_disposition": "RG",
                  "dst_x_amz_storage_class": "RH", "dst_content_range": "RI", "dst_pragma_type": "RJ",
                  "dst_allow": "RK", "dst_xms_backend_server": "RL", "dst_x_clickhouse_server_display_name": "RM",
                  "dst_x_clickhouse_summary": "RN", "dst_x_clickhouse_format": "RO", "dst_x_clickhouse_query_id": "RP",
                  "dst_x_clickhouse_timezone": "RQ", "dst_referrer_policy": "RR", "dst_content_security_policy": "RS",
                  "dst_content_id": "RT", "dst_sec_websocket_accept": "RU", "dst_upgrade": "RV",
                  "dst_tlogtraceid": "RW", "dst_sec_websocket_extensions": "RX", "dst_x_elastic_product": "RY",
                  "dst_via": "RZ", "dst_x_cache": "SA", "dst_x_amz_cf_id": "SB", "dst_x_amz_cf_pop": "SC",
                  "dst_rgwx_embedded_metadata_len": "SD", "dst_rgwx_mtime": "SE", "dst_rgwx_obj_pg_ver": "SF",
                  "dst_rgwx_object_size": "SG", "dst_rgwx_source_zone_short_id": "SH", "dst_x_amz_version_id": "SI",
                  "dst_x_request_id": "SJ", "dst_x_envoy_decorator_operation": "SK",
                  "dst_x_envoy_upstream_service_time": "SL", "dst_age": "SM", "dst_www_authenticate": "SN",
                  "dst_strict_transport_security": "SO", "dst_terminationurl": "SP", "dst_x_splunk_digest": "SQ",
                  "dst_x_splunk_lm_nonce": "SR", "dst_x_splunk_lm_timestamp": "SS", "dst_x_download_options": "ST",
                  "dst_x_permitted_cross_domain_policies": "SU", "dst_pragrma": "SV",
                  "dst_content_transfer_encoding": "SW", "dst_x_runtime": "SX", "dst_x_arequestid": "SY",
                  "dst_x_ausername": "SZ", "dst_x_asessionid": "TA", "dst_x_aspnet_version": "TB",
                  "dst_x_seraph_loginreason": "TC", "dst_accept_charset": "TD", "dst_n": "TE", "dst_error_code": "TF",
                  "dst_error_msg": "TG", "dst_x_w_no": "TH", "dst_kbn_license_sig": "TI", "dst_kbn_name": "TJ",
                  "dst_cross_origin_opener_policy": "TK", "dst_xdomainrequestallowed": "TL",
                  "dst_x_ratelimit_limit_vass_zuul_api_user_24": "TM",
                  "dst_x_ratelimit_remaining_vass_zuul_api_use": "TN",
                  "dst_x_ratelimit_remaining_vass_zuul_wx_port": "TO",
                  "dst_x_ratelimit_reset_vass_zuul_api_user_24": "TP", "dst_audit_id": "TQ",
                  "dst_x_kubernetes_pf_flowschema_uid": "TR", "dst_x_kubernetes_pf_prioritylevel_uid": "TS",
                  "dst_alt_svc": "TT", "dst_cf_ray": "TU", "dst_nel": "TV", "dst_report_to": "TW",
                  "dst_x_ratelimit_remaining_vass_zuul_api_ord": "TX", "dst_x_protected_by": "TY",
                  "dst_traceresponse": "TZ", "dst_x_br_response": "UA", "dst_x_cache_status": "UB",
                  "dst_x_ratelimit_limit_vass_zuul_api_order_1": "UC",
                  "dst_x_ratelimit_reset_vass_zuul_api_order_1": "UD", "dst_grpc_metadata_accept_encoding": "UE",
                  "dst_grpc_metadata_content_type": "UF", "dst_grpc_metadata_grpc_accept_encoding": "UG",
                  "dst_x_ratelimit_limit_vass_zuul_wx_port_240": "UH",
                  "dst_x_ratelimit_reset_vass_zuul_wx_port_240": "UI", "dst_permissions_policy": "UJ",
                  "dst_ctl_cache_status": "UK", "dst_progma": "UL", "dst_request_id": "UM", "dst_x_csrf_token": "UN",
                  "dst_x_log_append_meta": "UO", "dst_x_log_requestid": "UP", "dst_x_log_time": "UQ",
                  "dst_hostname": "UR", "dst_x_networkmanager_status": "US", "dst_browseruid": "UT",
                  "dst_k_cache_status": "UU", "dst_kcs_via": "UV", "dst_x_ccc": "UW", "dst_x_cid": "UX",
                  "dst_page_title": "UY", "dst_x_via": "UZ", "dst_x_ws_request_id": "VA",
                  "dst_enable_encrypted_library": "VB", "dst_expire": "VC",
                  "dst_x_ratelimit_limit_vass_zuul_wx_port_39.": "VD",
                  "dst_x_ratelimit_reset_vass_zuul_wx_port_39.": "VE", "dst_content_location": "VF", "dst_gsid": "VG",
                  "dst_sc": "VH", "dst_x_response_timestrap": "VI", "dst_link": "VJ",
                  "dst_x_ratelimit_limit_vass_zuul_api_order_2": "VK",
                  "dst_x_ratelimit_limit_vass_zuul_wx_port_10.": "VL",
                  "dst_x_ratelimit_reset_vass_zuul_api_order_2": "VM",
                  "dst_x_ratelimit_reset_vass_zuul_wx_port_10.": "VN", "dst_x_reqid": "VO", "dst_login": "VP",
                  "dst_x_cache_lookup": "VQ", "dst_x_cdn_request_id": "VR", "dst_x_link_via": "VS",
                  "dst_x_nws_log_uuid": "VT", "dst_x_ratelimit_limit_vass_zuul_wx_port_111": "VU",
                  "dst_x_ratelimit_reset_vass_zuul_wx_port_111": "VV", "dst_cache_contror": "VW", "dst_cdn_cache": "VX",
                  "dst_cdn_cachedat": "VY", "dst_cdn_edgestorageid": "VZ", "dst_cdn_proxyver": "WA",
                  "dst_cdn_pullzone": "WB", "dst_cdn_requestcountrycode": "WC", "dst_cdn_requestid": "WD",
                  "dst_cdn_requestpullcode": "WE", "dst_cdn_requestpullsuccess": "WF", "dst_cdn_status": "WG",
                  "dst_cdn_uid": "WH", "dst_gitlab_ci_builds_polling": "WI", "dst_new_jwt": "WJ",
                  "dst_ohc_cache_hit": "WK", "dst_ohc_file_size": "WL", "dst_ohc_global_saved_time": "WM",
                  "dst_x_hudson": "WN", "dst_x_instance_identity": "WO", "dst_x_jenkins": "WP",
                  "dst_x_jenkins_session": "WQ", "dst_dir_perm": "WR", "dst_fndfs_error": "WS", "dst_oid": "WT",
                  "dst_x_errno": "WU", "dst_x_hudson_theme": "WV", "dst_x_oss_hash_crc64ecma": "WW", "dst_x_ser": "WX",
                  "dst_content_md5": "WY", "dst_exception": "WZ", "dst_exceptiontype": "XA", "dst_praga": "XB",
                  "dst_x_oss_object_type": "XC", "dst_x_oss_request_id": "XD", "dst_x_oss_server_time": "XE",
                  "dst_x_oss_storage_class": "XF", "dst_x_ratelimit_limit_vass_zuul_api_order_3": "XG",
                  "dst_x_ratelimit_reset_vass_zuul_api_order_3": "XH", "packet_size_mean": "XI",
                  "packet_size_variance": "XJ", "packet_len_total_count": "XK", "packet_len_total_average": "XL",
                  "packet_len_total_min": "XM", "packet_len_total_max": "XN", "packet_len_total_rate": "XO",
                  "packet_len_total_percent": "XP", "packet_len_0_19_count": "XQ", "packet_len_0_19_average": "XR",
                  "packet_len_0_19_min": "XS", "packet_len_0_19_max": "XT", "packet_len_0_19_rate": "XU",
                  "packet_len_0_19_percent": "XV", "packet_len_20_39_count": "XW", "packet_len_20_39_average": "XX",
                  "packet_len_20_39_min": "XY", "packet_len_20_39_max": "XZ", "packet_len_20_39_rate": "YA",
                  "packet_len_20_39_percent": "YB", "packet_len_40_79_count": "YC", "packet_len_40_79_average": "YD",
                  "packet_len_40_79_min": "YE", "packet_len_40_79_max": "YF", "packet_len_40_79_rate": "YG",
                  "packet_len_40_79_percent": "YH", "packet_len_80_159_count": "YI", "packet_len_80_159_average": "YJ",
                  "packet_len_80_159_min": "YK", "packet_len_80_159_max": "YL", "packet_len_80_159_rate": "YM",
                  "packet_len_80_159_percent": "YN", "packet_len_160_319_count": "YO",
                  "packet_len_160_319_average": "YP", "packet_len_160_319_min": "YQ", "packet_len_160_319_max": "YR",
                  "packet_len_160_319_rate": "YS", "packet_len_160_319_percent": "YT", "packet_len_320_639_count": "YU",
                  "packet_len_320_639_average": "YV", "packet_len_320_639_min": "YW", "packet_len_320_639_max": "YX",
                  "packet_len_320_639_rate": "YY", "packet_len_320_639_percent": "YZ",
                  "packet_len_640_1279_count": "ZA", "packet_len_640_1279_average": "ZB",
                  "packet_len_640_1279_min": "ZC", "packet_len_640_1279_max": "ZD", "packet_len_640_1279_rate": "ZE",
                  "packet_len_640_1279_percent": "ZF", "packet_len_1280_2559_count": "ZG",
                  "packet_len_1280_2559_average": "ZH", "packet_len_1280_2559_min": "ZI",
                  "packet_len_1280_2559_max": "ZJ", "packet_len_1280_2559_rate": "ZK",
                  "packet_len_1280_2559_percent": "ZL", "packet_len_2560_5119_count": "ZM",
                  "packet_len_2560_5119_average": "ZN", "packet_len_2560_5119_min": "ZO",
                  "packet_len_2560_5119_max": "ZP", "packet_len_2560_5119_rate": "ZQ",
                  "packet_len_2560_5119_percent": "ZR", "packet_len_more_than_5120_count": "ZS",
                  "packet_len_more_than_5120_average": "ZT", "packet_len_more_than_5120_min": "ZU",
                  "packet_len_more_than_5120_max": "ZV", "packet_len_more_than_5120_rate": "ZW",
                  "packet_len_more_than_5120_percent": "ZX", "all_req_packet_size_mean": "ZY",
                  "all_req_packet_size_var": "ZZ", "all_res_packet_size_mean": "AAA", "all_res_packet_size_var": "AAB",
                  "all_req_packet_time_period_mean": "AAC", "all_res_packet_time_period_mean": "AAD",
                  "all_req_packet_time_period_var": "AAE", "all_res_packet_time_period_var": "AAF",
                  "req_header_count_mean": "AAG", "req_header_count_var": "AAH"}


class EmptyValue(Enum):
    IP_GEO_EMPTY = "IP_GEO_EMPTY"


# 统计字段对照：
statistic_fields = {
    'packet_size_mean': "",
    'packet_size_variance': "",
    'packet_len_total_count': "",
    'packet_len_total_average': "",
    'packet_len_total_min': "",
    'packet_len_total_max': "",
    'packet_len_total_rate': "",
    'packet_len_total_percent': "",
    'packet_len_0_19_count': "",
    'packet_len_0_19_average': "",
    'packet_len_0_19_min': "",
    'packet_len_0_19_max': "",
    'packet_len_0_19_rate': "",
    'packet_len_0_19_percent': "",
    'packet_len_20_39_count': "",
    'packet_len_20_39_average': "",
    'packet_len_20_39_min': "",
    'packet_len_20_39_max': "",
    'packet_len_20_39_rate': "",
    'packet_len_20_39_percent': "",
    'packet_len_40_79_count': "",
    'packet_len_40_79_average': "",
    'packet_len_40_79_min': "",
    'packet_len_40_79_max': "",
    'packet_len_40_79_rate': "",
    'packet_len_40_79_percent': "",
    'packet_len_80_159_count': "",
    'packet_len_80_159_average': "",
    'packet_len_80_159_min': "",
    'packet_len_80_159_max': "",
    'packet_len_80_159_rate': "",
    'packet_len_80_159_percent': "",
    'packet_len_160_319_count': "",
    'packet_len_160_319_average': "",
    'packet_len_160_319_min': "",
    'packet_len_160_319_max': "",
    'packet_len_160_319_rate': "",
    'packet_len_160_319_percent': "",
    'packet_len_320_639_count': "",
    'packet_len_320_639_average': "",
    'packet_len_320_639_min': "",
    'packet_len_320_639_max': "",
    'packet_len_320_639_rate': "",
    'packet_len_320_639_percent': "",
    'packet_len_640_1279_count': "",
    'packet_len_640_1279_average': "",
    'packet_len_640_1279_min': "",
    'packet_len_640_1279_max': "",
    'packet_len_640_1279_rate': "",
    'packet_len_640_1279_percent': "",
    'packet_len_1280_2559_count': "",
    'packet_len_1280_2559_average': "",
    'packet_len_1280_2559_min': "",
    'packet_len_1280_2559_max': "",
    'packet_len_1280_2559_rate': "",
    'packet_len_1280_2559_percent': "",
    'packet_len_2560_5119_count': "",
    'packet_len_2560_5119_average': "",
    'packet_len_2560_5119_min': "",
    'packet_len_2560_5119_max': "",
    'packet_len_2560_5119_rate': "",
    'packet_len_2560_5119_percent': "",
    'packet_len_more_than_5120_count': "",
    'packet_len_more_than_5120_average': "",
    'packet_len_more_than_5120_min': "",
    'packet_len_more_than_5120_max': "",
    'packet_len_more_than_5120_rate': "",
    'packet_len_more_than_5120_percent': "",
    "http.uri_length_mean": "同一个session中每个uri长度的均值",
    "http.uri_length_var": "同一个session中每个uri长度的uri长度方差",

    "http.uri_param_count_mean": "同一个session中每个uri参数均值",
    "http.uri_param_count_var": "同一个session中每个uri参数方差",

    "http.uri_depth_mean": "同一个session中每个uri深度均值",
    "http.uri_depth_var": "同一个session中每个uri深度方差",
    "http.uri_filename_length_mean": "同一个session中每个uri文件名长度均值",
    "http.uri_filename_length_var": "同一个session中每个uri文件名长度方差",

    "all_req_packet_size_mean": "同一个session中每个请求包大小的均值",
    "all_req_packet_size_var": "同一个session中每个请求包大小的方差",

    "all_res_packet_size_mean": "同一个session中每个响应包大小的均值",
    "all_res_packet_size_var": "同一个session中每个响应包大小的方差",

    "all_req_packet_time_period_mean": "同一个session中每个请求时间段的均值",
    "all_req_packet_time_period_var": "同一个session中每个请求时间段的方差",

    "all_res_packet_time_period_mean": "同一个session中每个响应时间段的均值",
    "all_res_packet_time_period_var": "同一个session中每个响应时间段的方差",
    "dns_domain_length_mean": "dns请求域名长度均值",
    "dns_domain_length_var": "dns请求域名长度方差",

    #不用管响应的
    "req_header_count_mean": "同一个session中每个请求包的头部参数数量均值",
    "req_header_count_var": "同一个session中每个请求包的头部参数数量方差",
    "same_src_dst_size_mean": "同目标ip端口的包大小的均值",  #后面去掉了同源端口ip
    "same_src_dst_size_var": "同目标ip端口的包大小的均值",  #后面去掉了同源端口ip

}


def generate_excel_columns(n):
    alphabet = string.ascii_uppercase
    col = []
    for i in range(n):
        key = ''
        j = i
        while j >= 0:
            key = alphabet[j % len(alphabet)] + key
            j = j // len(alphabet) - 1
        col.append(f"{key}")
    return col


if __name__ == '__main__':
    all_columns = sessionKeyname + otherHeader + statisticHeader
    columns = generate_excel_columns(len(all_columns))
    mapping = dict(zip(all_columns, columns))
    print(json.dumps(mapping))
